<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace app\models;

/**
 * Description of Goods
 *
 * @author Administrator
 */
class Goods extends \yii\db\ActiveRecord{
    //put your code here
    public function behaviors() {
        return [
            'behavior'=>[
                'class'=>\app\components\MyBehavior::className(),
            ]
        ];
    }
   public function beforeSave($insert){
       parent::beforeSave($insert);
   }
    
    public static function tableName() {
        return "t_goods";
    }
    //表单字段验证
    public function rules(){
        return [
            ['goods_name','required','message'=>'商品名称必填'],
            ['goods_name','string','max'=>6,'message'=>'商品名称过长'],
            ['goods_price','required','message'=>'商品价格必填'],

        ];
    }
}
